<extend name="Public/common"/>
<block name="othercss">
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
            //调用微信JS api 支付
            function jsApiCall()
            {
                WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                {$info['params']},
                function(res){
                    //WeixinJSBridge.log(res.err_msg);
                    if(res.err_desc){
                        alert(res.err_code + res.err_desc);
                    }else{
                        alert('支付成功！');
                    }
                    //alert(res.err_desc);
                    //alert(res.err_msg);
                    //todo 支付结果处理
                }
            );
            }

            function callpay()
            {
                if (typeof WeixinJSBridge == "undefined"){
                    if( document.addEventListener ){
                        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                    }else if (document.attachEvent){
                        document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                    }
                }else{
                    jsApiCall();
                }
            }
            //获取共享地址
            function editAddress()
            {
                WeixinJSBridge.invoke(
                        'editAddress',
                {$info['addr']},
                function(res){
                    var value1 = res.proviceFirstStageName;
                    var value2 = res.addressCitySecondStageName;
                    var value3 = res.addressCountiesThirdStageName;
                    var value4 = res.addressDetailInfo;
                    var tel = res.telNumber;
                    alert(value1 + value2 + value3 + value4 + ":" + tel);
                    //todo 收货地址处理
                }
            );
            }

            window.onload = function(){
                if (typeof WeixinJSBridge == "undefined"){
                    if( document.addEventListener ){
                        document.addEventListener('WeixinJSBridgeReady', editAddress, false);
                    }else if (document.attachEvent){
                        document.attachEvent('WeixinJSBridgeReady', editAddress);
                        document.attachEvent('onWeixinJSBridgeReady', editAddress);
                    }
                }else{
                    editAddress();
                }
            };

        </script>
</block>
<block name="body">
 <div class="mian" style="background-color: #f4f4f4;padding-bottom: 60px">
    <div class="box">
        <div class="clearfix syt-header">
            <div class="right">订单支付金额：
                <span class="price">¥ {$total|priceTofixed}</span>
            </div>
            <div class="left">
                <div class="l1 ones">订单编号：{$order_no}</div>
                <div class="l2 ones"><volist name="cart_list" id="item">{$item.goods_name} {$item.goods_spec}</volist></div>
            </div>
        </div>
        <div class="syt-body">
            <div class="t1">扫一扫付款（元）</div>
            <div class="t2">{$total|priceTofixed}</div>
            <div class="syt-box">
                <div class="imgs">
               
                    <img src="{$qrcode}" width="315" height="315"/>
                </div>
                <div class="sao">
                    <img src="{$theme_path}/images/sao.jpg" width="50" height="50"/>
                    <div class="sao-lans">打开手机微信
                        扫一扫继续付款</div>
                </div>
            </div>
        </div>
    </div>
</div>
</block>
<block name="otherjs">
<script type="text/javascript">
//定时执行，微信支付可用
viewInExplorerStatus()
function viewInExplorerStatus() {

var mydate = new Date();
	$.ajax({
	   url:"{:U('PayWechat/wechat_pay',Array('order_id'=>$order_id))}?n="+Math.random(),
			success:function(val)
			{
			
			if($.trim(val)=='1'){
			document.location = "{$success_page}";
			}
	       
			}
			});
  setTimeout("viewInExplorerStatus()",1000);
}

</script>
</block>